package com.redis.exception;

import com.redis.config.ResponseCodeEnum;

public class AppException extends RuntimeException {
    private String message;
    private Integer code;
    private Object item;
    private String relateId;

    public Integer getCode() {
        return this.code;
    }

    public Object getItem() {
        return this.item;
    }

    public String getRelateId() {
        return this.relateId;
    }

    public AppException(String message) {
        this(message, ResponseCodeEnum.SYSTEM_ERROR, "");
    }

    public AppException(String message, Exception innerException) {
        this(message, ResponseCodeEnum.SYSTEM_ERROR, "", (Object)null, innerException);
    }

    public AppException(String message, Integer p_ExceptionCode, String RelateId) {
        this(message, p_ExceptionCode, RelateId, (Object)null);
    }

    public AppException(String message, Integer code, String relateId, Object item) {
        super(message);
        this.message = message;
        this.code = code;
        this.item = item;
        this.relateId = relateId;
    }

    public AppException(String message, Integer code, String relateId, Object item, Exception innerException) {
        super(message, innerException);
        this.message = message;
        this.code = code;
        this.item = item;
        this.relateId = relateId;
    }

    public static AppException init(Exception e) {
        AppException ex = new AppException(e.getMessage());
        return ex;
    }
}

